extern crate bindgen;

// use std::collections::HashSet;


// Taken from https://github.com/rust-lang/rust-bindgen/issues/687#issuecomment-450750547
// #[derive(Debug)]
// struct IgnoreMacros(HashSet<String>);

// impl bindgen::callbacks::ParseCallbacks for IgnoreMacros {
//     fn will_parse_macro(&self, name: &str) -> bindgen::callbacks::MacroParsingBehavior {
//         if self.0.contains(name) {
//             bindgen::callbacks::MacroParsingBehavior::Ignore
//         } else {
//             bindgen::callbacks::MacroParsingBehavior::Default
//         }
//     }
// }

fn main() {
    // let mut clang_args = vec![];

    // let target = env::var("TARGET").unwrap();
    // let cross_key = format!("PKG_CONFIG_SYSROOT_DIR_{}", target);
    // match env:: var(cross_key){
    //     Ok(p) => {
    //         let path = PathBuf::from(p).join("usr").join("include");
    //         clang_args.push(format!("-I{}", path.display()));
    //     },
    //     Err(_) => {},
    // }


    // Tell cargo to tell rustc to link the system libiw
    // shared library.
    println!("cargo:rustc-link-lib=iw");

    // // Tell cargo to invalidate the built crate whenever the wrapper changes
    // println!("cargo:rerun-if-changed=wrapper.h");

    // let ignored_macros = IgnoreMacros(
    //     vec![
    //         "FP_INFINITE".into(),
    //         "FP_NAN".into(),
    //         "FP_NORMAL".into(),
    //         "FP_SUBNORMAL".into(),
    //         "FP_ZERO".into(),
    //         "IPPORT_RESERVED".into(),
    //     ]
    //     .into_iter()
    //     .collect(),
    // );

    // // The bindgen::Builder is the main entry point
    // // to bindgen, and lets you build up options for
    // // the resulting bindings.
    // let bindings = bindgen::Builder::default()
    //     // The input header we would like to generate
    //     // bindings for.
    //     .header("wrapper.h")
    //     .derive_default(true)
    //     .clang_args(&clang_args)
    //     // Tell cargo to invalidate the built crate whenever any of the
    //     // included header files changed.
    //     .parse_callbacks(Box::new(ignored_macros))
    //     // Finish the builder and generate the bindings.
    //     .generate()
    //     // Unwrap the Result and panic on failure.
    //     .expect("Unable to generate bindings");

    // // Write the bindings to the $OUT_DIR/bindings.rs file.
    // let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
    // bindings
    //     .write_to_file(out_path.join("bindings.rs"))
    //     .expect("Couldn't write bindings!");
}